package com.heking.commonlib;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.zhoug.common.router.ZRouter;


public class MainActivity extends AppCompatActivity {
    private MainActivity mSelf;
    private static final String TAG = ">>>MainActivity";
    private ListView mListView;
    private String[] items=new String[]{"BitmapUtils","AlphaView"," NotificationUtils"};
    private Class<? extends Activity> [] cls=new Class[]{
            BitmapUtilsActivity.class,
            AlphaViewActivity.class,
            NotificationActivity.class,
    };
    private AdapterView.OnItemClickListener onItemClickListener=new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ZRouter.navigation(mSelf, cls[position]);
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mSelf=this;
        findViews();
        initListView();
    }

    private void findViews() {
        mListView = findViewById(R.id.listView);
    }
    private void initListView(){
        mListView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,items));
        mListView.setOnItemClickListener(onItemClickListener);
    }
}